home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.11 Nov 95 / ODF Beeper / Sources / BeeperSel.cpp < prev    next >
Encoding:
Text File  |  1995-09-26  |  3.9 KB  |  168 lines  |  [TEXT/MPS ]

  1. //==========================================================
  2. //
  3. //    File:                BeeperSel.cpp
  4. //    Release Version:    $ 1.0d9 $
  5. //
  6. //    Author:                M.Boetcher
  7. //
  8. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //==========================================================
  11.  
  12. #ifndef BEEPERSEL_H
  13. #include "BeeperSel.h"
  14. #endif
  15.  
  16. #ifndef BEEPERPART_H
  17. #include "BeeperPart.h"
  18. #endif
  19.  
  20. #ifndef BEEPERDEF_H
  21. #include "BeeperDef.h"
  22. #endif
  23.  
  24. #ifndef ACTIONS_H
  25. #include "Actions.h"
  26. #endif
  27.  
  28. // ----- Framework Includes -----
  29.  
  30. #ifndef FWPRESEN_H
  31. #include "FWPresen.h"
  32. #endif
  33.  
  34. // ----- OS Layer -----
  35.  
  36. #ifndef FWBARRAY_H
  37. #include "FWBArray.h"
  38. #endif
  39.  
  40. #ifndef FWMEMMGR_H
  41. #include "FWMemMgr.h"
  42. #endif
  43.  
  44. // ----- OpenDoc Includes -----
  45.  
  46. #ifndef SOM_Module_OpenDoc_StdProps_defined
  47. #include <StdProps.xh>
  48. #endif
  49.  
  50. // ----- Macintosh Includes -----
  51.  
  52. #if defined(FW_BUILD_MAC) && !defined(__DRAG__)
  53. #include <Drag.h>
  54. #endif
  55.  
  56. //==========================================================
  57. //    Runtime information
  58. //==========================================================
  59.  
  60. #ifdef FW_BUILD_MAC
  61. #pragma segment BeeperPart
  62. #endif
  63.  
  64. //==========================================================
  65. //    CLASS CBeeperSelection
  66. //==========================================================
  67.  
  68. //----------------------------------------------------------
  69. //    CBeeperSelection constructor
  70. //----------------------------------------------------------
  71.  
  72. CBeeperSelection::CBeeperSelection(Environment* ev, 
  73.                                 CBeeperPart* beeperPart) :
  74.     FW_CSelection(ev, FALSE, FALSE),
  75.     fBeeperPart(beeperPart)
  76. {
  77. }
  78.  
  79. //----------------------------------------------------------
  80. //    CBeeperSelection destructor
  81. //----------------------------------------------------------
  82.  
  83. CBeeperSelection::~CBeeperSelection()
  84. {
  85. }
  86.  
  87. //----------------------------------------------------------
  88. //    CBeeperSelection::CloseSelection
  89. //----------------------------------------------------------
  90.  
  91. void CBeeperSelection::CloseSelection(Environment* ev)
  92. {
  93.     // Nothing to do
  94. }
  95.  
  96. //----------------------------------------------------------
  97. //    CBeeperSelection::ClearSelection
  98. //----------------------------------------------------------
  99.  
  100. FW_Boolean CBeeperSelection::ClearSelection(Environment* ev, 
  101.                             FW_ClearSelection clearAfter)
  102. {
  103.     return FALSE; // Do nothing
  104. }
  105.  
  106. //----------------------------------------------------------
  107. //    CBeeperSelection::IsEmpty
  108. //----------------------------------------------------------
  109.  
  110. FW_Boolean CBeeperSelection::IsEmpty(Environment* ev) const
  111. {
  112.     return (fBeeperPart->GetAction() == NULL);
  113. }
  114.  
  115. //----------------------------------------------------------
  116. //    CBeeperSelection::SelectAll
  117. //----------------------------------------------------------
  118.  
  119. void CBeeperSelection::SelectAll(Environment* ev)
  120. {
  121.     // Nothing to do
  122. }
  123.  
  124. //----------------------------------------------------------
  125. //    CBeeperSelection::DoExternalizeSelection
  126. //----------------------------------------------------------
  127.  
  128. void CBeeperSelection::DoExternalizeSelection(
  129.                             Environment* ev, 
  130.                             ODStorageUnit* storage, 
  131.                             FW_CCloneInfo* cloneInfo)
  132. {
  133.     CAction *action = fBeeperPart->GetAction();
  134.     if (action)
  135.     {
  136.         storage->AddProperty(ev, kODPropContents);
  137.         action->Externalize(ev, storage);
  138.     }
  139. }
  140.  
  141. //----------------------------------------------------------
  142. //    CBeeperSelection::DoInternalizeSelection
  143. //----------------------------------------------------------
  144.  
  145. FW_Boolean CBeeperSelection::DoInternalizeSelection(
  146.                             Environment* ev,
  147.                             ODStorageUnit* storage, 
  148.                             FW_CCloneInfo* cloneInfo)
  149. {
  150.     FW_Boolean internalized = FALSE;
  151.     
  152.     CAction *action = NULL;
  153.     if (CScriptAction::IsInStorage(ev, storage))
  154.         action = new CScriptAction();
  155.     else if (CSoundAction::IsInStorage(ev, storage))
  156.         action = new CSoundAction();
  157.     
  158.     if (action != NULL)
  159.     {
  160.         action->Internalize(ev, storage);
  161.         fBeeperPart->SetAction(action);
  162.         fBeeperPart->Changed(ev);
  163.         internalized = true;
  164.     }
  165.  
  166.     return internalized;
  167. }
  168.